package com.ssish.saas.eccs.mapper;

import com.ssish.saas.eccs.model.PlanMastInfo;
import com.ssish.saas.eccs.model.PlanMastInfoExample;
import com.ssish.saas.eccs.model.PlanMastInfoKey;
import com.ssish.saas.eccs.model.PlanMastInfoWithBLOBs;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface PlanMastInfoMapper {
    long countByExample(PlanMastInfoExample example);

    int deleteByExample(PlanMastInfoExample example);

    @Delete({
        "delete from PLANMAST_INFO",
        "where PAYOR_CODE = #{payorCode,jdbcType=CHAR}",
          "and GROUP_CODE = #{groupCode,jdbcType=VARCHAR}",
          "and CORP_CODE = #{corpCode,jdbcType=VARCHAR}",
          "and PLAN_CODE = #{planCode,jdbcType=VARCHAR}",
          "and COVERAGE_CODE = #{coverageCode,jdbcType=CHAR}",
          "and BENEFIT_CODE = #{benefitCode,jdbcType=CHAR}"
    })
    int deleteByPrimaryKey(PlanMastInfoKey key);

    @Insert({
        "insert into PLANMAST_INFO (PAYOR_CODE, GROUP_CODE, ",
        "CORP_CODE, PLAN_CODE, ",
        "COVERAGE_CODE, BENEFIT_CODE, ",
        "UPDATE_BY, UPDATE_DATE, ",
        "CASHLESS_SERVICE_AREA, RESTRICTED_PROVIDER, ",
        "SPECIAL_CLAUSE, ENDORSEMENT, ",
        "PREAUTH, EXCLUSIONS)",
        "values (#{payorCode,jdbcType=CHAR}, #{groupCode,jdbcType=VARCHAR}, ",
        "#{corpCode,jdbcType=VARCHAR}, #{planCode,jdbcType=VARCHAR}, ",
        "#{coverageCode,jdbcType=CHAR}, #{benefitCode,jdbcType=CHAR}, ",
        "#{updateBy,jdbcType=VARCHAR}, #{updateDate,jdbcType=TIMESTAMP}, ",
        "#{cashlessServiceArea,jdbcType=CLOB}, #{restrictedProvider,jdbcType=CLOB}, ",
        "#{specialClause,jdbcType=CLOB}, #{endorsement,jdbcType=CLOB}, ",
        "#{preauth,jdbcType=CLOB}, #{exclusions,jdbcType=CLOB})"
    })
    int insert(PlanMastInfoWithBLOBs record);

    int insertSelective(PlanMastInfoWithBLOBs record);

    List<PlanMastInfoWithBLOBs> selectByExampleWithBLOBs(PlanMastInfoExample example);

    List<PlanMastInfo> selectByExample(PlanMastInfoExample example);

    @Select({
        "select",
        "PAYOR_CODE, GROUP_CODE, CORP_CODE, PLAN_CODE, COVERAGE_CODE, BENEFIT_CODE, UPDATE_BY, ",
        "UPDATE_DATE, CASHLESS_SERVICE_AREA, RESTRICTED_PROVIDER, SPECIAL_CLAUSE, ENDORSEMENT, ",
        "PREAUTH, EXCLUSIONS",
        "from PLANMAST_INFO",
        "where PAYOR_CODE = #{payorCode,jdbcType=CHAR}",
          "and GROUP_CODE = #{groupCode,jdbcType=VARCHAR}",
          "and CORP_CODE = #{corpCode,jdbcType=VARCHAR}",
          "and PLAN_CODE = #{planCode,jdbcType=VARCHAR}",
          "and COVERAGE_CODE = #{coverageCode,jdbcType=CHAR}",
          "and BENEFIT_CODE = #{benefitCode,jdbcType=CHAR}"
    })
    @ResultMap("com.ssish.saas.eccs.mapper.PlanMastInfoMapper.ResultMapWithBLOBs")
    PlanMastInfoWithBLOBs selectByPrimaryKey(PlanMastInfoKey key);

    int updateByExampleSelective(@Param("record") PlanMastInfoWithBLOBs record, @Param("example") PlanMastInfoExample example);

    int updateByExampleWithBLOBs(@Param("record") PlanMastInfoWithBLOBs record, @Param("example") PlanMastInfoExample example);

    int updateByExample(@Param("record") PlanMastInfo record, @Param("example") PlanMastInfoExample example);

    int updateByPrimaryKeySelective(PlanMastInfoWithBLOBs record);

    @Update({
        "update PLANMAST_INFO",
        "set UPDATE_BY = #{updateBy,jdbcType=VARCHAR},",
          "UPDATE_DATE = #{updateDate,jdbcType=TIMESTAMP},",
          "CASHLESS_SERVICE_AREA = #{cashlessServiceArea,jdbcType=CLOB},",
          "RESTRICTED_PROVIDER = #{restrictedProvider,jdbcType=CLOB},",
          "SPECIAL_CLAUSE = #{specialClause,jdbcType=CLOB},",
          "ENDORSEMENT = #{endorsement,jdbcType=CLOB},",
          "PREAUTH = #{preauth,jdbcType=CLOB},",
          "EXCLUSIONS = #{exclusions,jdbcType=CLOB}",
        "where PAYOR_CODE = #{payorCode,jdbcType=CHAR}",
          "and GROUP_CODE = #{groupCode,jdbcType=VARCHAR}",
          "and CORP_CODE = #{corpCode,jdbcType=VARCHAR}",
          "and PLAN_CODE = #{planCode,jdbcType=VARCHAR}",
          "and COVERAGE_CODE = #{coverageCode,jdbcType=CHAR}",
          "and BENEFIT_CODE = #{benefitCode,jdbcType=CHAR}"
    })
    int updateByPrimaryKeyWithBLOBs(PlanMastInfoWithBLOBs record);

    @Update({
        "update PLANMAST_INFO",
        "set UPDATE_BY = #{updateBy,jdbcType=VARCHAR},",
          "UPDATE_DATE = #{updateDate,jdbcType=TIMESTAMP}",
        "where PAYOR_CODE = #{payorCode,jdbcType=CHAR}",
          "and GROUP_CODE = #{groupCode,jdbcType=VARCHAR}",
          "and CORP_CODE = #{corpCode,jdbcType=VARCHAR}",
          "and PLAN_CODE = #{planCode,jdbcType=VARCHAR}",
          "and COVERAGE_CODE = #{coverageCode,jdbcType=CHAR}",
          "and BENEFIT_CODE = #{benefitCode,jdbcType=CHAR}"
    })
    int updateByPrimaryKey(PlanMastInfo record);
}